<?php
    include './connect.php';
    
    $strSQL = "SELECT * FROM `supplier` WHERE SupplierCode = '".$_POST["txtSupplierCode"]."'";
    $objQuery = mysqli_query($MechanicDB,$strSQL) or die(mysqli_error($MechanicDB)) ;
    if($objQuery->num_rows > 0){
        echo 'duplicate';
        return false;
    }
    
    $strSQL = "INSERT INTO `supplier`(`SupplierCode`, `SupplierName`, `Tel`, `Address`, `remark`) ";
    $strSQL .= "VALUES ('".$_POST["txtSupplierCode"]."','".$_POST["txtSupplierName"]."','".$_POST["txtTel"]."','".$_POST["txtAddress"]."','".$_POST["txtRemark"]."')";
    //$strSQL .= " VALUES ("..","..","..")";
    mysqli_query($MechanicDB,$strSQL) or die(mysqli_error($MechanicDB)) ;
    
    echo 'success';
?>
